package com.zjm.structural.adapter.objectadapter;

/**
 * 适配器类
 * 对象适配器
 */
public class VoltageAdapter implements IVoltage5V {

    // 继承改为聚组合
    private Voltage220V voltage220V;

    // 构造器
    public VoltageAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        int dstV = 0;
        if (voltage220V != null) {
            int srcV = voltage220V.output220V();
            dstV = srcV / 44;
        }
        return dstV;
    }
}
